package Offer;


public class Test28 
{

	public static void main(String[] args) 
	{
		char[] ch ={'a','b','c'};
		permutation(ch);
	}
	public static void permutation(char[] ch)
	{
		if(ch==null||ch.length==0)
			return;
		permutation(ch,0,ch.length-1);
	}
	public static void permutation(char[]ch,int start,int end)
	{
		if(start==end)
		{
			System.out.print(ch);
			System.out.print(" ");
		}
	    for(int i=start;i<=end;i++)
	    {
	    	char temp = ch[i];
	    	ch[i] = ch[start];
	    	ch[start] = temp;
	    	permutation(ch,start+1,end);
	    	temp = ch[i];
	    	ch[i] = ch[start];
	    	ch[start] = temp;
	    }
	}
		

}
